A r t i c l e s
Navigation

Note: This site is
a bit older, personal views
may have changed.

M a i n P a g e

D i r e c t o r y

PHP Author Admits To Obfuscation In Manual


Reinventing readable code?
Quoted from an older version of the PHP manual:
It is important to note that the flow of the language is not dependent on the 
organization of the script blocks within the code. You can start an if expression in 
one block and have the end of the expression in another. For example:

   <? if($a==5 &&  $b!=0) >
                  <b> Normal html text </b>
        <? endif >

In this example it is easy to see why it is sometimes more desirable to use the endif 
keyword as opposed to a closing brace. The above is much more readable than the 
following:

   <? if($a==5 &&  $b!=0) { >
                  <b> Normal html text </b>
        <? } >

Both version are valid and they will do exactly the same thing


It is funny how we can reinvent languages and admit to obfuscation, isn't it, oh Mr. and Mrs. PHP?

So what's next, you'll be able to replace the opening paranthesis with the begin keyword? Better yet, to make it even more ridiculous, let's call it beginif. That would be reinventing, yes.

Then, let's go one step further and start replacing all those && $b! and ($a== and other bizarre concoctions with something reasonable. Oh, but then it just wouldn't be C any more. I mean PHP.



About
This site is about programming and other things.
_ _ _